package cn.lg.soar.mvc.aspect.log.model;

import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;

/**
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
public class DataConfig implements Config {

        private final Expression dataExpression;

        private final Expression dataIdExpression;

        public DataConfig(Expression dataExpression, Expression dataIdExpression) {
            this.dataExpression = dataExpression;
            this.dataIdExpression = dataIdExpression;
        }

        @Override
        public Object getData(EvaluationContext context) {
            return this.dataExpression.getValue(context, Object.class);
        }

    @Override
    public Object getDataId(EvaluationContext context) {
        return this.dataIdExpression.getValue(context, Object.class);
    }

}
